<%@ page contentType="text/html; charset=UTF-8" %>
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>New project</title>
<link href="style.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="css/datepicker.css"><script type="text/javascript" language="javascript" src="js/datepicker.js"></script>
<script language="javascript">
	function empty()
	{
		err_name.innerText = "";
		err_code.innerText = "";
		err_description.innerText = "";
		err_id_type.innerText = "";
		err_pm.innerText = "";
		err_status.innerText = "";
		err_plan_start_date.innerText = "";
		err_plan_end_date.innerText = "";
		err_real_start_date.innerText = "";
		err_real_end_date.innerText = "";
		err_creator.innerText = "";
		err_id_company.innerText = "";
	}

	function checkInput()
	{
		empty();
		var result = true;
		if(document.fmInsert.name.value=="")
		{
			err_name.innerText=" Please input name";
			result = false;
		}
		if(document.fmInsert.code.value=="")
		{
			err_code.innerText=" Please input code";
			result = false;
		}
		if(document.fmInsert.description.value=="")
		{
			err_description.innerText=" Please input description";
			result = false;
		}
		if(document.fmInsert.id_type.value=="")
		{
			err_id_type.innerText=" Please input id_type";
			result = false;
		}
		if(document.fmInsert.pm.value=="")
		{
			err_pm.innerText=" Please input pm";
			result = false;
		}
		if(document.fmInsert.status.value=="")
		{
			err_status.innerText=" Please input status";
			result = false;
		}
		if(document.fmInsert.plan_start_date.value=="")
		{
			err_plan_start_date.innerText=" Please input plan_start_date";
			result = false;
		}
		if(document.fmInsert.plan_end_date.value=="")
		{
			err_plan_end_date.innerText=" Please input plan_end_date";
			result = false;
		}
		if(document.fmInsert.real_start_date.value=="")
		{
			err_real_start_date.innerText=" Please input real_start_date";
			result = false;
		}
		if(document.fmInsert.real_end_date.value=="")
		{
			err_real_end_date.innerText=" Please input real_end_date";
			result = false;
		}
		if(document.fmInsert.creator.value=="")
		{
			err_creator.innerText=" Please input creator";
			result = false;
		}
		if(document.fmInsert.id_company.value=="")
		{
			err_id_company.innerText=" Please input id_company";
			result = false;
		}
		return result;
	}

	function showHide(shID)
	{
		if(document.getElementById(shID).style.display == 'none')
			document.getElementById(shID).style.display = 'block';
		else
			document.getElementById(shID).style.display = 'none';
	}
</script>
</head>
<body>
<TABLE class="tbmain" width="100%">
<TR HEIGHT="150">
<TD align="center" colspan="5"><%@include file="top.jsp"%></TD>
</TR>
<TR HEIGHT="12"><TD colspan="5" bgcolor="black"></TD></TR>
<TR HEIGHT="518">
<TD class="tdleft"><%@include file="left.jsp"%></TD>
<TD bgcolor="black" width="1%"></TD>
<TD class="tdbody">
<form name="fmInsert" method="post" onsubmit="return checkInput();" action="projectInsertServlet">
<fieldset>
<legend>New project</legend>
<table>
<tr>
<td>name:</td>
<td><input type="text" name="name"></td>
<td class="err" id="err_name"></td>
</tr>
<tr>
<td>code:</td>
<td><input type="text" name="code"></td>
<td class="err" id="err_code"></td>
</tr>
<tr>
<td>description:</td>
<td><input type="text" name="description"></td>
<td class="err" id="err_description"></td>
</tr>
<tr>
<td>id_type:</td>
<td><input type="text" name="id_type"></td>
<td class="err" id="err_id_type"></td>
</tr>
<tr>
<td>pm:</td>
<td><input type="text" name="pm"></td>
<td class="err" id="err_pm"></td>
</tr>
<tr>
<td>is_template:</td>
<td>
<p>Is null<input type="checkbox" value="null" name="chk_is_template" onchange="showHide('p_is_template');"></p>
<p id="p_is_template">yes<input type="radio" value="true" name="is_template" checked="">no<input type="radio" value="true" name="is_template"></p>
</td>
<td></td>
</tr>
<tr>
<td>status:</td>
<td><input type="text" name="status"></td>
<td class="err" id="err_status"></td>
</tr>
<tr>
<td>plan_start_date:</td>
<td><input type="text" name="plan_start_date" id="plan_start_date"><input type="button" value="..." onclick="javascript:displayDatePicker('plan_start_date', this, 'mdy');"></td>
<td class="err" id="err_plan_start_date"></td>
</tr>
<tr>
<td>plan_end_date:</td>
<td><input type="text" name="plan_end_date" id="plan_end_date"><input type="button" value="..." onclick="javascript:displayDatePicker('plan_end_date', this, 'mdy');"></td>
<td class="err" id="err_plan_end_date"></td>
</tr>
<tr>
<td>real_start_date:</td>
<td><input type="text" name="real_start_date" id="real_start_date"><input type="button" value="..." onclick="javascript:displayDatePicker('real_start_date', this, 'mdy');"></td>
<td class="err" id="err_real_start_date"></td>
</tr>
<tr>
<td>real_end_date:</td>
<td><input type="text" name="real_end_date" id="real_end_date"><input type="button" value="..." onclick="javascript:displayDatePicker('real_end_date', this, 'mdy');"></td>
<td class="err" id="err_real_end_date"></td>
</tr>
<tr>
<td>creator:</td>
<td><input type="text" name="creator"></td>
<td class="err" id="err_creator"></td>
</tr>
<tr>
<td>deleted:</td>
<td>
<p>Is null<input type="checkbox" value="null" name="chk_deleted" onchange="showHide('p_deleted');"></p>
<p id="p_deleted">yes<input type="radio" value="true" name="deleted" checked="">no<input type="radio" value="true" name="deleted"></p>
</td>
<td></td>
</tr>
<tr>
<td>id_company:</td>
<td><input type="text" name="id_company"></td>
<td class="err" id="err_id_company"></td>
</tr>
</table><input type="submit" value="Insert"><input type="reset" value="Reset"></fieldset>
</form>
</TD>
<TD bgcolor="black" width="1%"></TD>
<TD class="tdright" vAlign="top"><%@include file="right.jsp"%></TD>
</TR>
<TR HEIGHT="12"><TD colspan="5" bgcolor="black"></TD></TR>
<TR HEIGHT="100">
<TD colspan="5" align="center"><%@include file="bottom.jsp"%></TD>
</TR>
</TABLE>
</body>
</html>
